package com.js.common.service.impl;

import com.js.common.entity.BaseEntity;
import com.js.common.entity.BizEntity;
import com.js.common.util.EntityUtils;

import java.util.List;

/**
 * @author ygl
 * @create 2018-11-12
 * @DESCRIPTION
 * 业务逻辑接口实现类
 **/
public class BizServiceImpl<T extends BizEntity> extends BaseServiceImpl<T> {

    @Override
    public int insertSelective(T t) {
        EntityUtils.setCreateAndUpdateInfo(t);
        return super.insertSelective(t);
    }

    @Override
    public int insertList(List<T> list) {
        for (T t : list) {
            EntityUtils.setCreateAndUpdateInfo(t);
        }
        return super.insertList(list);
    }

    @Override
    public int updateById(T t) {
        EntityUtils.setUpdateInfo(t);
        return super.updateById(t);
    }

    @Override
    public int updateSelectiveById(T t) {
        EntityUtils.setUpdateInfo(t);
        return super.updateSelectiveById(t);
    }
}
